namespace Windows.Dns
{
    /// <summary>
    /// An SOA Resource Record (RR) (RFC1035 3.3.13)
    /// </summary>
    public class SrvRecord : RecordBase
    {
        // these fields constitute an SOA RR
        public int Priority { get; set; }
        public int Weight { get; set; }
        public int Port { get; set; }
        public string Target { get; set; }

        /// <summary>
        /// Constructs an SOA record by reading bytes from a return message
        /// </summary>
        /// <param name="pointer">A logical pointer to the bytes holding the record</param>
        internal SrvRecord(Pointer pointer)
        {
            Priority = pointer.ReadShort();
            Weight = pointer.ReadShort();
            Port= pointer.ReadShort();
            Target= pointer.ReadDomain();


        }

        public override string ToString()
        {
            return string.Format("priority = {0}\nweight = {1}\nport = {2}\nsrv hostname = {3}",
                                 Priority,
                                 Weight,
                                 Port,
                                 Target);
        }
    }
}